import request from '@/utils/request'
import type { LoginForm, LoginResponseData, UserResponseData} from './type'
/*
type CustomFunc = (data: LoginForm) => any | LoginResponseData
export const login: CustomFunc = (data) => {
  return request({
    url: '/user/login',
    method: 'POST',
    data,
  })
}

export const login = (data:LoginForm): any | LoginResponseData => {
  return request({
    url: '/user/login',
    method: 'GET',
    params:data,
  })
}
*/
enum API {
  login_url = '/admin/acl/index/login',
  userInfo = '/admin/acl/index/info',
  logout_url = '/admin/acl/index/logout',
}

// 登录
export const Login = (data: LoginForm) => request.post<any, LoginResponseData>(API.login_url, data)

// 获取用户信息
export const getUserInfo = () => request.get<any, UserResponseData>(API.userInfo)

// 退出登录
export const reqLogout = () => request.post<any, any>(API.logout_url)